package com.wuxf.controller;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.wuxf.entity.DicDataInfo;
import com.wuxf.entity.ReceivePhone;
import com.wuxf.entity.ResponseBodyEntity;
import com.wuxf.entity.custom.PwdCustom;
import com.wuxf.entity.custom.UserInfoCustom;
import com.wuxf.service.DicDataService;
import com.wuxf.service.PwdService;
import com.wuxf.service.ReceiveService;

@Controller
@RequestMapping("receive")
@SuppressWarnings({ "rawtypes", "unchecked" })
public class ReceiveController {

	@Autowired
	private ReceiveService receiveService;
	
	
	@RequestMapping("findReceive")
	public @ResponseBody ResponseBodyEntity findReceive(int userId) {
		ResponseBodyEntity responseBodyEntity = new ResponseBodyEntity();
		responseBodyEntity.setData(receiveService.findByUserId(userId));
		responseBodyEntity.setState("1");
		responseBodyEntity.setMsg("查询所属发票接收人");
		return responseBodyEntity;
	}
	
	
	@RequestMapping("saveReceive")
	public @ResponseBody ResponseBodyEntity saveReceive(ReceivePhone receivePhone) {
		ResponseBodyEntity responseBodyEntity = new ResponseBodyEntity();
		responseBodyEntity.setData(receiveService.saveReceivePhone(receivePhone));
		responseBodyEntity.setState("1");
		responseBodyEntity.setMsg("保存接收人信息");
		return responseBodyEntity;
	}
	
	//删除跟车人
	@RequestMapping("deleteReceivePhone")
	public @ResponseBody ResponseBodyEntity deleteCarArea(int receiveId){
		ResponseBodyEntity responseBodyEntity = new ResponseBodyEntity();
		receiveService.deleteReceivePhone(receiveId);
		responseBodyEntity.setCode(0);
		responseBodyEntity.setState("1");
		return responseBodyEntity;
	}
	
	
}
